package hrc.tool.xml;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
/**
 * 
 * @author hrc
 * @see XmlTeller
 */
class OldFileXmlTeller extends XmlTeller {

	OldFileXmlTeller(String fileName) throws XmlException {
		super.fileName = fileName;
		this.readOldXml();
	}

	private void readOldXml() throws XmlException {
		try {
			DocumentBuilderFactory domfac = DocumentBuilderFactory
					.newInstance();
			DocumentBuilder dombuilder = domfac.newDocumentBuilder();
			InputStream is = new FileInputStream(new File(this.fileName));
			m_doc = dombuilder.parse(is);
		} catch (Exception e) {
			throw new XmlException("fail to read old xml file");
		}
	}

	@Override
	public void save() throws XmlException {
		super.saveXml();
	}
}
